package com.rdr.randDinnner.utils;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.NoArgsConstructor;

@NoArgsConstructor
@Data
public class Result {

    @JsonProperty("address")
    private String address;
    @JsonProperty("ad_info")
    private AdInfoDTO adInfo;
    @JsonProperty("address_reference")
    private AddressReferenceDTO addressReference;
    @JsonProperty("location")
    private LocationDTO location;
    @JsonProperty("formatted_addresses")
    private FormattedAddressesDTO formattedAddresses;
    @JsonProperty("address_component")
    private AddressComponentDTO addressComponent;


    @NoArgsConstructor
    @Data
    public static class AdInfoDTO {
        @JsonProperty("province")
        private String province;
        @JsonProperty("adcode")
        private String adcode;
        @JsonProperty("nation")
        private String nation;
        @JsonProperty("city")
        private String city;
        @JsonProperty("district")
        private String district;
        @JsonProperty("name")
        private String name;
        @JsonProperty("city_code")
        private String cityCode;
        @JsonProperty("location")
        private LocationDTO location;
        @JsonProperty("nation_code")
        private String nationCode;
    }

    @NoArgsConstructor
    @Data
    public static class AddressReferenceDTO {
        @JsonProperty("town")
        private StreetDTO town;
        @JsonProperty("famous_area")
        private StreetDTO famousArea;
        @JsonProperty("street")
        private StreetDTO street;
        @JsonProperty("crossroad")
        private StreetDTO crossroad;
        @JsonProperty("street_number")
        private StreetDTO streetNumber;
        @JsonProperty("business_area")
        private StreetDTO businessArea;
        @JsonProperty("landmark_l2")
        private StreetDTO landmarkL2;

        @NoArgsConstructor
        @Data
        public static class StreetDTO {
            @JsonProperty("_distance")
            private Double distance;
            @JsonProperty("_dir_desc")
            private String dirDesc;
            @JsonProperty("location")
            private LocationDTO location;
            @JsonProperty("id")
            private String id;
            @JsonProperty("title")
            private String title;

        }

    }

    @NoArgsConstructor
    @Data
    public static class LocationDTO {
        @JsonProperty("lng")
        private Double lng;
        @JsonProperty("lat")
        private Double lat;
    }

    @NoArgsConstructor
    @Data
    public static class FormattedAddressesDTO {
        @JsonProperty("rough")
        private String rough;
        @JsonProperty("recommend")
        private String recommend;
    }

    @NoArgsConstructor
    @Data
    public static class AddressComponentDTO {
        @JsonProperty("province")
        private String province;
        @JsonProperty("nation")
        private String nation;
        @JsonProperty("city")
        private String city;
        @JsonProperty("street")
        private String street;
        @JsonProperty("district")
        private String district;
        @JsonProperty("street_number")
        private String streetNumber;
    }
}
